<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use DB;
class ArticleSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $faker = \Faker\Factory::create('zh_CN');
        $keywords = ['Linux','Java','PHP','web','前端','后台','全栈','h5','javascript'];
        $title = ['细说PHP','生活很美好','玩转java','Linux就该这么学','h5大前端'];
        $count = count($title);
        $len = count($keywords);
        for($i = 0; $i < 10; $i++) {
        	$data = [
        		'title' => $title[mt_rand(0,$count-1)],
        		'content' => $faker -> text(),
        		'keyword' => $keywords[mt_rand(0,$len-1)].','.$keywords[mt_rand(0,$len-1)],
        		'u_id' => mt_rand(1,10),
                'path' => '/uploads/'
        		'created_at' => date('Y-m-d H:i:s',time()),
        		'updated_at' => date('Y-m-d H:i:s',time())
        	];

        	DB::table('article') -> insert($data);
        }
    }
}
